#实现或门（带偏置）
import numpy as np

def OR(x1, x2):
    x = np.array([x1, x2])  #输入
    w = np.array([0.5, 0.5])  #权重
    b = -0.2  #偏置
    temp = np.sum(w*x) + b
    if temp <= 0:
        return 0
    else:
        return 1

data = np.array([[0, 0], [1, 0], [0, 1], [1, 1]])
for element in data:
    result = OR(element[0], element[1])
    print(str(element) + ' -> ' + str(result))
